<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:74:"/Users/ztos/workspace/shyp/public/../application/admin/view/menu/sort.html";i:1502695296;s:76:"/Users/ztos/workspace/shyp/public/../application/admin/view/base/common.html";i:1510722990;}*/ ?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo \think\Config::get('web_site_title'); ?> | 超级后台</title>
    <!-- CSS Files -->
    <link href="/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/admin/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <style type="text/css">
        .profile-element { text-align: center; }
        .img-circle {  width:48px; }
        .label small{
            font-size: 12px !important;
        }
    </style>

    <!-- iCheck -->
    <link href="/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- Toastr style -->
    <link href="/admin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <!-- CSS Files -->
    <link href="/admin/css/animate.css" rel="stylesheet">
    <link href="/admin/css/style.css" rel="stylesheet">
    <link href="/admin/css/main.css" rel="stylesheet">
    <script src="/static/js/jquery-3.1.1.min.js"></script>
    <script src="/static/js/jquery-migrate-3.0.0.min.js"></script>
    
<style type="text/css">
	select[size] {
		height: 300px;
		width: 270px;
	}
	.ibox-content{
		height:500px;
	}
	.sort_option {
		float: left;
		margin-right: 16px;
	}
	.sort_bottom {
		margin-top: 155px;
	}
	.sort_btn button {
		display: block;
		margin-bottom: 15px;
	}
	.btn {
		color: #edffd1;
		background-color: #1cc09f;
	}
	.btn {
		display: inline-block;
		margin-right: 5px;
		padding: 6px 16px;
		font-size: 14px;
		line-height: 18px;
		color: #fff;
		text-align: center;
		vertical-align: middle;
		cursor: pointer;
		border: 0 none;
		background-color: #1cc09f;
	}

	.submit-btn {
		color: #fff;
		background-color: #CC3900;
	}
	.submit-btn, .btn-return {
		padding: 10px 50px;
		color: #fff;
		font-weight: bold;
		border-color: transparent;
	}
</style>

</head>
<body>
<div id="wrapper">
    <!-- 左侧系统菜单栏 -->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <div class="nav-header">
                    <div class="dropdown profile-element">
                        <span><?php if($user_auth['header'] == ''): ?><img alt="image" class="img-circle" src="/admin/images/profile_small.jpg" /><?php else: ?><img alt="image" style="width: 48px;height: 48px;" class="img-circle" src="<?php echo $user_auth['header']; ?>" /><?php endif; ?></span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold"></strong></span>
                            <span class="text-muted text-xs block"><?php echo $user_auth['group_name']; ?><b class="caret"></b></span> </span> </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li><a href="<?php echo Url('User/profile'); ?>">个人信息</a></li>
                            <li><a href="<?php echo Url('Message/index'); ?>">消息中心</a></li>
                            <li class="divider"></li>
                            <li><a href="<?php echo Url('Base/logout'); ?>">退出</a></li>
                        </ul>
                    </div>
                    <div class="logo-element">VAN+</div>
                </div>
                <?php if(is_array($__MENU__) || $__MENU__ instanceof \think\Collection || $__MENU__ instanceof \think\Paginator): $i = 0; $__LIST__ = $__MENU__;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;if(empty($menu['child']) || (($menu['child'] instanceof \think\Collection || $menu['child'] instanceof \think\Paginator ) && $menu['child']->isEmpty())): if($menu['id'] == $subMenu['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                <a href="<?php echo Url($menu['url']); ?>"><i class="fa <?php echo $menu['icon']; ?>"></i><span class="nav-label"><?php echo $menu['title']; ?></span></a></li>
                <?php else: if($subMenu['pid'] == $menu['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                <a href="<?php echo Url($menu['url']); ?>"><i class="fa <?php echo $menu['icon']; ?>"></i> <span class="nav-label"><?php echo $menu['title']; ?></span>
                    <?php if($menu['url'] == 'admin/Message/index'): ?>
                    <span class="label label-warning pull-right"><?php echo $messageTotal; ?></span>
                    <?php else: ?>
                    <span class="fa arrow"></span>
                    <?php endif; ?>
                </a>
                <ul class="nav nav-second-level collapse <?php if($subMenu['pid'] == $menu['id']): ?>in<?php endif; ?>">
                    <?php if(is_array($menu['child']) || $menu['child'] instanceof \think\Collection || $menu['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $menu['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$child): $mod = ($i % 2 );++$i;if($subMenu['id'] == $child['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                    <a href="<?php echo Url($child['url']); ?>"><?php echo $child['title']; ?></a></li>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </ul></li>
                <?php endif; endforeach; endif; else: echo "" ;endif; ?>
            </ul>
        </div>
    </nav>
    <!-- 右侧主体内容 -->
    <div id="page-wrapper" class="gray-bg">
        <!-- 中间头部 -->
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top white-bg" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    <form role="search" class="navbar-form-custom" action="<?php echo Url('Index/search'); ?>">
                        <div class="form-group">
                            <input type="text" placeholder="搜索内容" class="form-control" name="top-search" id="top-search">
                        </div>
                    </form>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <span class="m-r-sm text-muted welcome-message">欢迎使用<?php echo \think\Config::get('web_site_title'); ?></span>
                    </li>
                    <li class="dropdown">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                            <i class="fa fa-envelope"></i><span class="label label-warning"><?php echo $messageTotal; ?></span>
                        </a>
                    </li>
                    <li>
                        <a href="<?php echo Url('Base/logout'); ?>"><i class="fa fa-sign-out"></i> 退出</a>
                    </li>
                    <li>
                        <a class="right-sidebar-toggle"><i class="fa fa-tasks"></i></a>
                    </li>
                </ul>
            </nav>
        </div>
        <!-- 页面路径 -->
        
<div class="row wrapper border-bottom white-bg page-heading">
	<div class="col-lg-10">
		<h2>菜单排序</h2>
		<ol class="breadcrumb">
			<li><a href="<?php echo \think\Cookie::get('__forward__'); ?>">Config</a></li>
			<li class="active"><strong>Sort</strong></li>
		</ol>
	</div>
	<div class="col-lg-2">

	</div>
</div>

        <!-- 中间主体内容 -->
        
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox-content">
		<div class="sort">
			<form class="sort-form" action="<?php echo Url('sort'); ?>" method="post">
				<div class="sort_center">
					<div class="sort_option">
						<select value="" size="8">
							<?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
							<option class="ids" title="<?php echo $vo['title']; ?>" value="<?php echo $vo['id']; ?>"><?php echo $vo['title']; ?></option>
							<?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
					<div class="sort_btn">
						<button class="top btn" type="button">第 一</button>
						<button class="up btn" type="button">上 移</button>
						<button class="down btn" type="button">下 移</button>
						<button class="bottom btn" type="button">最 后</button>
					</div>
				</div>
				<div class="sort_bottom">
					<input type="hidden" name="ids">
					<button class="sort_confirm btn submit-btn" type="button">确 定</button>
					<button class="sort_cancel btn btn-return " type="button" url="<?php echo \think\Cookie::get('__forward__'); ?>">返 回</button>
				</div>
			</form>
		</div>
	</div>
</div>

        <!-- 底部信息 -->
        <div class="footer">
            <div class="pull-right">版本 <strong><?php echo \think\Config::get('web_version'); ?></strong></div>
            <div><strong>Copyright</strong> <?php echo \think\Config::get('web_company_name'); ?> &copy; 2016-2017</div>
        </div>
    </div>
    <!-- 右侧工具栏 -->
</div>
<!-- Mainly scripts -->
<script src="/admin/js/bootstrap.min.js"></script>
<script src="/admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="/admin/js/inspinia.js"></script>
<script src="/admin/js/plugins/pace/pace.min.js"></script>
<script src="/admin/js/common.js"></script>
<!-- Toastr script -->
<script src="/admin/js/plugins/toastr/toastr.min.js"></script>
<script src="/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="/admin/js/plugins/sweetalert/sweetalert.min.js"></script>


<script type="text/javascript">

	$(function(){
		sort();
		$(".top").click(function(){
			rest();
			$("option:selected").prependTo("select");
			sort();
		})
		$(".bottom").click(function(){
			rest();
			$("option:selected").appendTo("select");
			sort();
		})
		$(".up").click(function(){
			rest();
			$("option:selected").after($("option:selected").prev());
			sort();
		})
		$(".down").click(function(){
			rest();
			$("option:selected").before($("option:selected").next());
			sort();
		})
		$(".search").click(function(){
			var v = $("input").val();
			$("option:contains("+v+")").attr('selected','selected');
		})
		function sort(){
			$('option').text(function(){return ($(this).index()+1)+'.'+$(this).text()});
		}

		//重置所有option文字。
		function rest(){
			$('option').text(function(){
				return $(this).text().split('.')[1]
			});
		}

		//获取排序并提交
		$('.sort_confirm').click(function(){
			var arr = new Array();
			$('.ids').each(function(){
				arr.push($(this).val());
			});
			$('input[name=ids]').val(arr.join(','));
			$.post(
					$('.sort-form').attr('action'),
					{
						'ids' :  arr.join(',')
					},
					function(data){
						if (data.code == 1) {
							swal(data.msg, "页面即将自动跳转!", "success");
						}else{
							swal(data.msg,"请重试!", "error");
						}
						setTimeout(function(){
							if (data.code) {
								$('.sort_cancel').click();
							}
						},1500);
					},
					'json'
			);
		});

		//点击取消按钮
		$('.sort_cancel').click(function(){
			window.location.href = $(this).attr('url');
		});

		highlight_subnav("<?php echo Url('Menu/index'); ?>");

	})
</script>

</body>
</html>
